package com.xiashitech.interfaces.grpc;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.58.0)",
    comments = "Source: agent.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class RPCAgentStatusServiceGrpc {

  private RPCAgentStatusServiceGrpc() {}

  public static final java.lang.String SERVICE_NAME = "com.xiashitech.interfaces.grpc.RPCAgentStatusService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcRegistAgentStatusMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "grpcRegistAgentStatus",
      requestType = com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.class,
      responseType = com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcRegistAgentStatusMethod() {
    io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcRegistAgentStatusMethod;
    if ((getGrpcRegistAgentStatusMethod = RPCAgentStatusServiceGrpc.getGrpcRegistAgentStatusMethod) == null) {
      synchronized (RPCAgentStatusServiceGrpc.class) {
        if ((getGrpcRegistAgentStatusMethod = RPCAgentStatusServiceGrpc.getGrpcRegistAgentStatusMethod) == null) {
          RPCAgentStatusServiceGrpc.getGrpcRegistAgentStatusMethod = getGrpcRegistAgentStatusMethod =
              io.grpc.MethodDescriptor.<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "grpcRegistAgentStatus"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RPCAgentStatusServiceMethodDescriptorSupplier("grpcRegistAgentStatus"))
              .build();
        }
      }
    }
    return getGrpcRegistAgentStatusMethod;
  }

  private static volatile io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcSyncAgentHostMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "grpcSyncAgentHost",
      requestType = com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.class,
      responseType = com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcSyncAgentHostMethod() {
    io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getGrpcSyncAgentHostMethod;
    if ((getGrpcSyncAgentHostMethod = RPCAgentStatusServiceGrpc.getGrpcSyncAgentHostMethod) == null) {
      synchronized (RPCAgentStatusServiceGrpc.class) {
        if ((getGrpcSyncAgentHostMethod = RPCAgentStatusServiceGrpc.getGrpcSyncAgentHostMethod) == null) {
          RPCAgentStatusServiceGrpc.getGrpcSyncAgentHostMethod = getGrpcSyncAgentHostMethod =
              io.grpc.MethodDescriptor.<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "grpcSyncAgentHost"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RPCAgentStatusServiceMethodDescriptorSupplier("grpcSyncAgentHost"))
              .build();
        }
      }
    }
    return getGrpcSyncAgentHostMethod;
  }

  private static volatile io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getBiAgentStatusMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "biAgentStatus",
      requestType = com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.class,
      responseType = com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
  public static io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
      com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getBiAgentStatusMethod() {
    io.grpc.MethodDescriptor<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> getBiAgentStatusMethod;
    if ((getBiAgentStatusMethod = RPCAgentStatusServiceGrpc.getBiAgentStatusMethod) == null) {
      synchronized (RPCAgentStatusServiceGrpc.class) {
        if ((getBiAgentStatusMethod = RPCAgentStatusServiceGrpc.getBiAgentStatusMethod) == null) {
          RPCAgentStatusServiceGrpc.getBiAgentStatusMethod = getBiAgentStatusMethod =
              io.grpc.MethodDescriptor.<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest, com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "biAgentStatus"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.xiashitech.interfaces.grpc.RPCSystemInfoResponse.getDefaultInstance()))
              .setSchemaDescriptor(new RPCAgentStatusServiceMethodDescriptorSupplier("biAgentStatus"))
              .build();
        }
      }
    }
    return getBiAgentStatusMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static RPCAgentStatusServiceStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCAgentStatusServiceStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCAgentStatusServiceStub>() {
        @java.lang.Override
        public RPCAgentStatusServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCAgentStatusServiceStub(channel, callOptions);
        }
      };
    return RPCAgentStatusServiceStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static RPCAgentStatusServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCAgentStatusServiceBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCAgentStatusServiceBlockingStub>() {
        @java.lang.Override
        public RPCAgentStatusServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCAgentStatusServiceBlockingStub(channel, callOptions);
        }
      };
    return RPCAgentStatusServiceBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static RPCAgentStatusServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<RPCAgentStatusServiceFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<RPCAgentStatusServiceFutureStub>() {
        @java.lang.Override
        public RPCAgentStatusServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new RPCAgentStatusServiceFutureStub(channel, callOptions);
        }
      };
    return RPCAgentStatusServiceFutureStub.newStub(factory, channel);
  }

  /**
   */
  public interface AsyncService {

    /**
     * <pre>
     * agent 启动时注册一次，无需流
     * </pre>
     */
    default void grpcRegistAgentStatus(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGrpcRegistAgentStatusMethod(), responseObserver);
    }

    /**
     * <pre>
     * agent 会上报一次或者多次 Host 信息，无需流
     * </pre>
     */
    default void grpcSyncAgentHost(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGrpcSyncAgentHostMethod(), responseObserver);
    }

    /**
     * <pre>
     * 服务端推送客户端状态信息，目前主要是让 agent 改为旁路或改为正常，为增强可靠性，增加定时心跳，改用双向流
     * </pre>
     */
    default io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest> biAgentStatus(
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getBiAgentStatusMethod(), responseObserver);
    }
  }

  /**
   * Base class for the server implementation of the service RPCAgentStatusService.
   */
  public static abstract class RPCAgentStatusServiceImplBase
      implements io.grpc.BindableService, AsyncService {

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return RPCAgentStatusServiceGrpc.bindService(this);
    }
  }

  /**
   * A stub to allow clients to do asynchronous rpc calls to service RPCAgentStatusService.
   */
  public static final class RPCAgentStatusServiceStub
      extends io.grpc.stub.AbstractAsyncStub<RPCAgentStatusServiceStub> {
    private RPCAgentStatusServiceStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCAgentStatusServiceStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCAgentStatusServiceStub(channel, callOptions);
    }

    /**
     * <pre>
     * agent 启动时注册一次，无需流
     * </pre>
     */
    public void grpcRegistAgentStatus(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getGrpcRegistAgentStatusMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * agent 会上报一次或者多次 Host 信息，无需流
     * </pre>
     */
    public void grpcSyncAgentHost(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request,
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getGrpcSyncAgentHostMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * 服务端推送客户端状态信息，目前主要是让 agent 改为旁路或改为正常，为增强可靠性，增加定时心跳，改用双向流
     * </pre>
     */
    public io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoRequest> biAgentStatus(
        io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> responseObserver) {
      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
          getChannel().newCall(getBiAgentStatusMethod(), getCallOptions()), responseObserver);
    }
  }

  /**
   * A stub to allow clients to do synchronous rpc calls to service RPCAgentStatusService.
   */
  public static final class RPCAgentStatusServiceBlockingStub
      extends io.grpc.stub.AbstractBlockingStub<RPCAgentStatusServiceBlockingStub> {
    private RPCAgentStatusServiceBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCAgentStatusServiceBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCAgentStatusServiceBlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     * agent 启动时注册一次，无需流
     * </pre>
     */
    public com.xiashitech.interfaces.grpc.RPCSystemInfoResponse grpcRegistAgentStatus(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getGrpcRegistAgentStatusMethod(), getCallOptions(), request);
    }

    /**
     * <pre>
     * agent 会上报一次或者多次 Host 信息，无需流
     * </pre>
     */
    public com.xiashitech.interfaces.grpc.RPCSystemInfoResponse grpcSyncAgentHost(com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getGrpcSyncAgentHostMethod(), getCallOptions(), request);
    }
  }

  /**
   * A stub to allow clients to do ListenableFuture-style rpc calls to service RPCAgentStatusService.
   */
  public static final class RPCAgentStatusServiceFutureStub
      extends io.grpc.stub.AbstractFutureStub<RPCAgentStatusServiceFutureStub> {
    private RPCAgentStatusServiceFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected RPCAgentStatusServiceFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new RPCAgentStatusServiceFutureStub(channel, callOptions);
    }

    /**
     * <pre>
     * agent 启动时注册一次，无需流
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> grpcRegistAgentStatus(
        com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getGrpcRegistAgentStatusMethod(), getCallOptions()), request);
    }

    /**
     * <pre>
     * agent 会上报一次或者多次 Host 信息，无需流
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse> grpcSyncAgentHost(
        com.xiashitech.interfaces.grpc.RPCSystemInfoRequest request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getGrpcSyncAgentHostMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_GRPC_REGIST_AGENT_STATUS = 0;
  private static final int METHODID_GRPC_SYNC_AGENT_HOST = 1;
  private static final int METHODID_BI_AGENT_STATUS = 2;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final AsyncService serviceImpl;
    private final int methodId;

    MethodHandlers(AsyncService serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_GRPC_REGIST_AGENT_STATUS:
          serviceImpl.grpcRegistAgentStatus((com.xiashitech.interfaces.grpc.RPCSystemInfoRequest) request,
              (io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>) responseObserver);
          break;
        case METHODID_GRPC_SYNC_AGENT_HOST:
          serviceImpl.grpcSyncAgentHost((com.xiashitech.interfaces.grpc.RPCSystemInfoRequest) request,
              (io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_BI_AGENT_STATUS:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.biAgentStatus(
              (io.grpc.stub.StreamObserver<com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
    return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
        .addMethod(
          getGrpcRegistAgentStatusMethod(),
          io.grpc.stub.ServerCalls.asyncUnaryCall(
            new MethodHandlers<
              com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
              com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>(
                service, METHODID_GRPC_REGIST_AGENT_STATUS)))
        .addMethod(
          getGrpcSyncAgentHostMethod(),
          io.grpc.stub.ServerCalls.asyncUnaryCall(
            new MethodHandlers<
              com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
              com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>(
                service, METHODID_GRPC_SYNC_AGENT_HOST)))
        .addMethod(
          getBiAgentStatusMethod(),
          io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
            new MethodHandlers<
              com.xiashitech.interfaces.grpc.RPCSystemInfoRequest,
              com.xiashitech.interfaces.grpc.RPCSystemInfoResponse>(
                service, METHODID_BI_AGENT_STATUS)))
        .build();
  }

  private static abstract class RPCAgentStatusServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    RPCAgentStatusServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.xiashitech.interfaces.grpc.RPCAgentServiceApi.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("RPCAgentStatusService");
    }
  }

  private static final class RPCAgentStatusServiceFileDescriptorSupplier
      extends RPCAgentStatusServiceBaseDescriptorSupplier {
    RPCAgentStatusServiceFileDescriptorSupplier() {}
  }

  private static final class RPCAgentStatusServiceMethodDescriptorSupplier
      extends RPCAgentStatusServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final java.lang.String methodName;

    RPCAgentStatusServiceMethodDescriptorSupplier(java.lang.String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (RPCAgentStatusServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new RPCAgentStatusServiceFileDescriptorSupplier())
              .addMethod(getGrpcRegistAgentStatusMethod())
              .addMethod(getGrpcSyncAgentHostMethod())
              .addMethod(getBiAgentStatusMethod())
              .build();
        }
      }
    }
    return result;
  }
}
